<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%-- <%@ page import="java.text.SimpleDateFormat"%>  --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>公司团队</title>
<%@ include file="/common/importLib.jsp" %>
<script type="text/javascript">
	/**
	 * easyui 数字combobox
	 * @param elementId
	 * @param selectValue
	 * @param numArray
	 */
	function textCombobox_2(elementId,selectValue,prec){
		var numArray = null;
		var textArray = null;
		numArray = [1,2,3];
		textArray = ["专家团队","指导师团队","顾问团队"];
		var data = "["; 
		var i=0;
		for(;i<numArray.length-1;i++){		
			data += '{"id": ' + numArray[i].toFixed(prec) + ', "text": "' + textArray[i] + '"},';		
		}
		data += '{"id": ' + numArray[i].toFixed(prec) + ', "text": "' + textArray[i] + '"}]';	
		$("#" + elementId + "Select").combobox({
			data: eval(data),
			valueField:'id',
			textField:'text',
			onSelect:function(data){
				$("#" + elementId).val(data.id);
				$("#" + elementId).focus();
				$("#" + elementId).blur();
			},
			onChange:function(data){			
				$("#" + elementId).val(data);
				$("#" + elementId).focus();
				$("#" + elementId).blur();
			}
		}).combobox("select",selectValue);
	}

	/**
	 * 增删改查参数设置
	 */
	tableTitle = "团队信息表";
	tableURL = getTimeURL("schoolTeam/schoolTeamList.do");
	toolbarView = 3;
	tableColumns = [[{field:'ck',checkbox:true},
						{field:'opt',title:'操作',width:130,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){	
							var queryUrl = 'schoolTeam/queryById.do?id=' + rowData.id;						
							return "<a title='修改' class='xxl_file_linkbutton' iconCls='icon-edit' href='javascript:datagridUpdate(\"" + queryUrl + "\")'>修改</a>";
						}
					},
	                {field:'id',title:'id',width:0,rowspan:1},	
	                {field:'teamImg',title:'图片',width:70,align:'center',rowspan:1,
						formatter:function(value,rowData,rowIndex){
							var url=mrjyFile+"maintain/schoolpic/"+rowData.teamImg+"?"+new Date().getTime();
							return "<img onclick=\"viewPic('"+url+"')\" src='"+url+"' style='width:50px;height:40px;'/>";
						}},
					{field:'teamCode',title:'成员编号',width:120,align:'center',rowspan:1},
	                {field:'teamName',title:'成员名称',width:120,align:'center',rowspan:1},
	                {field:'teamDesc',title:'成员简介',width:420,align:'center',rowspan:1}
					//{field:'schoolName',title:'学校名称',width:220,align:'center',rowspan:1}
					]];
	
	var addWidth = 900; //添加窗口宽度
	var addHeight = 400; //添加窗口高度
	var addTitle = "添加成员"; //添加标题
	var updateWidth = 900; //修改窗口宽度
	var updateHeight = 400; //修改窗口高度
	var updateTitle = "修改成员"; //修改标题
	var deleteUri = "schoolTeam/deleteByIds.do"; //删除记录
	
	/**
	 * 初始化添加表单
	 */	
	function initAddForm(){	
		openPicUpload();
		//combobox_5("schoolId", "schoolInfo/schoolList.do", true,"");
		addFormProcess("teamName","成员名称",true);
		numCombobox_2("teamCode","1",0,50);
		//$("#schoolId_1").val(schoolId);
		baseFormValidator("teamName","成员名称",2,40); 	
		baseFormValidator("teamLable","成员标签",2,26); 	
		baseFormValidator("teamDesc","个人简介",1,600);
		$("#picName").attr("src","../common/images/tip.png");
		textCombobox_2("teamType","1",0);
	}
	
	/**
	 * 初始化修改表单
	 */
	function initUpdateForm(jsonObject){
		$("#teamImgUpdate").val(jsonObject.teamImg);
		openPicUploadUpdate();
		$("#picNameUpdate").attr("src",imgTip(jsonObject.teamImg));
		$("#idUpdate").val(jsonObject.id);
		$("#teamDescUpdate").val(jsonObject.teamDesc);
		$("#teamNameUpdate").val(jsonObject.teamName);
		$("#teamLableUpdate").val(jsonObject.teamLable);
		addFormProcess("teamName","成员名称",true);
		//combobox_5("schoolIdUpdate", "../schoolInfo/schoolList.do", true,jsonObject.schoolId);
		baseFormValidator("teamNameUpdate","成员名称",2,40); 	
		baseFormValidator("teamLableUpdate","成员名称",2,26); 	
		baseFormValidator("teamDescUpdate","个人简介",1,600);
		updateFormProcess("teamNameUpdate","成员名称",true);	
		numCombobox_2("teamCodeUpdate",jsonObject.teamCode,0,50);
		textCombobox_2("teamTypeUpdate",jsonObject.teamType,0);
		combobox_select_frist("teacherIdUpdate",
				"../maintain/userInfo/userListNoPage.do?roleId=2", true,
				jsonObject.teacherId);
	}
	/**
	 *打开照片上传组件
	 */
	function openPicUpload(){
		uploadOneFile("uploadFile","/mrjy_file/common/util/upload.do","1000KB",100,30,"uploadMessage","backup/maintain/schoolpic/","teamImg","picName");
	}
	/**
	 *打开修改照片上传组件
	 */
	function openPicUploadUpdate(){
		uploadOneFile("uploadFileUpdate","/mrjy_file/common/util/upload.do","1000KB",100,30,"uploadMessageUpdate","backup/maintain/schoolpic/","teamImgUpdate","picNameUpdate");
	}
	function imgTip(imgName){
		if(imgName==""){
			return "../common/images/tip.png";
		}else{
			return mrjyFile+"maintain/schoolpic/"+imgName;
		}
	}
</script>
<script type="text/javascript">
function clearForm(){
	$('#schId').combobox('clear');
}
</script>
</head>
<body id="layout" class="easyui-layout">
	<!-- <div style="background: none repeat scroll 0% 0% #EFEFEF; height:75px; padding: 6px 2px; border-bottom: 1px solid #CCC;"
		region="north"  split="false" title="条件查询">
	<form  id="searchForm" >
	<table>
		
	</table>
	</form>
	</div> -->
	<div region="center">
	<!-- datagrid信息表 -->
	<table id="datagrid_table"></table>
	</div>
	<!-- 添加记录 -->
	<div id="datagrid_add" style="display: none;">
		<form id="add_form" action="schoolTeam/addSchoolTeam.do" method="post">
		<input type="hidden" id="teamImg" name="teamImg" onclick='openPicUpload()'>
		
			<table align="center" style="margin: 0 auto" class="xxl_file_tb_1">
				<tbody>
					<tr height="10px;"></tr>
					<!-- <tr id="school_name">
						<td  class="xxl_file_td_1">学校名称：</td>
						<td ><input type="text" id="schoolId" name="schoolId" /></td>
						<td ></td>
					</tr> -->
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员编号：</td>
						<td>
						<input type="text" id="teamCodeSelect" name="teamCode" /></td>
						<td></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员姓名：</td>
						<td>
						<input type="text" id="teamName" name="teamName" /></td>
						<td><div id="teamNameTip" style="width:250px"></div></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">团队类型：</td>
						<td>
						 <input type="text" id="teamTypeSelect" name="teamType" /> 
						
						</td>
						<td></td>
					</tr>
					
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员标签：</td>
						<td>
						<input type="text" id="teamLable" name="teamLable" /></td>
						<td><div id="teamLableTip" style="width:250px"></div></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td  class="xxl_file_td_1">照片：</td>
						<td >
							<div class="div"><input id='uploadFile' type='file' name='uploadFile'/><span id='uploadMessage'></span>
							</div><img style="height: 80px;width: 80px;" id ="picName" src=""/>
						</td>
						<td ><div style="color:red"> *照片后缀名为png，格式为200*200px</div></td>
					</tr>
					<tr>
						<td  class="xxl_file_td_1">个人简介：</td>
						<td >
							<textarea id="teamDesc" name="teamDesc" style="width: 500px;height: 200px"></textarea>
							<div id="teamDescTip" style="width:250px"></div>
						</td>
						<td>
							<div style="margin-top: 40px;"><a class='xxl_bt xxl_bt_1 ' style="font-size: 18px" onclick="addLine('teamDesc')">插入分行符</a></div>
							<div style="color:red"> * 为了显示信息协调，请适当的插入分行符! ! !</div>
						</td>
					</tr>								
					<tr>
						<td colspan="3" style="text-align: center">					
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#add_form').submit();">添加</a>
							<a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('add_form').reset()">重置</a>
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_add').window('close');">取消</a>
						</td>
					</tr>
					<tr height="20px;"></tr>
				</tbody>
			</table>
		</form>
	</div>
	
	<!-- 修改记录 -->
	<div id="datagrid_update" style="display: none;">
		<form id="update_form" action="schoolTeam/updateById.do" method="post">
			<input type="hidden" id="idUpdate" name="id"/>
			<input type="hidden" id="teamImgUpdate" name="teamImg" onclick='openPicUploadUpdate()'>
			<table align="center" style="margin: 0 auto" class="xxl_file_tb_1">
				<tbody>
					<tr height="10px;"></tr>
					<!-- <tr id="school_name_update">
						<td  class="xxl_file_td_1">学校名称：</td>
						<td ><input type="text" id="schoolIdUpdate" name="schoolId" /></td>
						<td ></td>
					</tr> -->
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员编号：</td>
						<td><input type="text" id="teamCodeUpdateSelect" name="teamCode" /></td>
						<td></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员姓名：</td>
						<td><input type="text" id="teamNameUpdate" name="teamName" /></td>
						<td><div id="teamNameUpdateTip" style="width:250px"></div></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员编号：</td>
						<td><input type="text" id="teamTypeUpdateSelect" name="teamType" /></td>
						<td></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_td_2">关联的老师：</td>
						<td><input type="text" id="teacherIdUpdate" name="teacherId" /></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td class="xxl_file_td_1">成员标签：</td>
						<td>
						<input type="text" id="teamLableUpdate" name="teamLable" /></td>
						<td><div id="teamLableUpdateTip" style="width:250px"></div></td>
					</tr>
					<tr height="20px;"></tr>
					<tr>
						<td  class="xxl_file_td_1">照片：</td>
						<td >
							<div class="div"><input id='uploadFileUpdate' type='file' name='uploadFile'/><span id='uploadMessageUpdate'></span></div>
							<img style="height: 80px;width: 80px;" id ="picNameUpdate" src=""/>
						</td>
						<td ><div style="color:red"> *照片后缀名为png，格式为200*200px</div></td>
					</tr>
					<tr>
						<td  class="xxl_file_td_1">个人简介：</td>
						<td >
							<textarea id="teamDescUpdate" name="teamDesc" style="width: 500px;height: 200px"></textarea>
							<div id="teamDescUpdateTip" style="width:250px"></div>
						</td>
						<td>
							<div style="margin-top: 40px;"><a class='xxl_bt xxl_bt_1 ' style="font-size: 18px" onclick="addLine('teamDescUpdate')">插入分行符</a></div>
							<div style="color:red"> * 为了显示信息协调，请适当的插入分行符! ! !</div>
						</td>
					</tr>			
					<tr>
						<td colspan="3" style="text-align: center">					
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#update_form').submit();">修改</a>		
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_update').window('close');">取消</a>
						</td>
					</tr>
					<tr height="20px;"></tr>
				</tbody>
			</table>
		</form>
	</div>
</body>
</html>